<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Cadastro de Alunos</title>
<link href="css/estilo.css" rel="stylesheet" type="text/css">
</head>
<body>
<f:view>
		<h:outputText styleClass="title" value="Listagem de Alunos" />
		<br>
		<br>

<rich:messages layout="table" infoLabelClass="messageInfo"
			errorLabelClass="messageInfo">
			<f:facet name="infoMarker">
				<h:graphicImage value="imagens/sucesso.gif" />
			</f:facet>
			<f:facet name="errorMarker">
				<h:graphicImage value="images/erro.gif" />
			</f:facet>
		</rich:messages>
<h:form id="lista">
<h:panelGrid columns="3">
<h:outputText value = "Nome: "/>
<h:inputText id="Nome" value="#{alunoBean.desc}" size="30" />
<h:message for="Nome" style="color: darkred" />
</h:panelGrid>
<h:commandButton value="Pesquisar" action="#{alunoBean.pesquisaAlunos}"/>

		
		</h:form>
		
		<h:form>
		<rich:dataTable id="alunos" border="1" value="#{alunoBean.lista}" binding="#{alunoBean.objDataTableAluno}"
			var="a" rendered="#{not empty alunoBean.lista}" rows="10">
			<h:column>
				<f:facet name="header">
					<h:outputText value="Id" />
				</f:facet>
				<h:outputText value="#{a.id}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Nome" />
				</f:facet>
				<h:outputText value="#{a.nome}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Idade" />
				</f:facet>
				<h:outputText value="#{a.idade}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Excluir" />
				</f:facet>
				<center> <h:commandButton action="#{alunoBean.excluir}" styleClass="botoesImgs" /></center>
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Alterar" />
				</f:facet>
				<center> <h:commandButton action="#{alunoBean.alterar}" styleClass="botoesImgs" /></center>
			</h:column>
			<f:facet name="footer">
				<!--<rich:datascroller />-->
			</f:facet>
		</rich:dataTable>

	</h:form>
</f:view>

</body>
</html>